package com.apes.scm.sal.saleOrder.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * @program:
 * @description:
 * @author: lws
 * @create: 2023/3/21 11:38
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = SaleOrderCoupons.CONST_TABLE_NAME)
public class SaleOrderCoupons extends Model {
    public static final String CONST_TABLE_NAME = "sale_order_coupons";

    @Id
    @Column(name = "id")
    @Comment("分销订单卡券关联表")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "分销订单卡券关联编码", padding = 7)
    private String id;

    @Column(name = "source")
    @Comment("app来源id")
    private String source;

    @Column(name = "sale_Order_Item_Id")
    @Comment("分销订单明细编号")
    private String saleOrderItemId;

    @Column(name = "sale_Order_Unique")
    @Comment("分销单唯一值")
    private String saleOrderUnique;

    @Column(name = "coupons_id")
    @Comment("卡券编号")
    private String couponsId;

    @Column(name = "retail_Order_Id")
    @Comment("零售单编码")
    private String retailOrderId;

    @Column(name = "name")
    @Comment("卡券名称")
    private String name;

    @Column(name = "type_Label")
    @Comment("类型名称")
    private String typeLabel;

    @Column(name = "car_number", length = 32)
    @Comment("车牌号")
    private String carNumber;

    @JSONField(format = DateUtil.SHOW_DATETIME_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "pay_date")
    @Comment("支付时间")
    private Date payDate;
}
